$(function() {

	var resultPage = {
		createNew: function() {
			var result = {};
			result.infotype = "";
			var queryreport = QueryReport.createNew();
			result.init = function() {
				this.initData();
				this.bindEvent();
			};
			result.initData = function() {				
				var translogno = getUrlParam('trans_log_no');
				result.infotype = getUrlParam('info_type');
				var queryinforUrl = (result.infotype == '1')? 'ajax_person_report_info': 'ajax_merchant_report_info';
				
				$.ajax({
					type: "GET",
					url: CONFIGER_MANAGER.DOMAIN + queryinforUrl + "?u_id=" + getLocalStorage(STORATE_MANAGER.user).u_id,
					async: true,
					dataType: 'JSON',
					beforeSend:function(){ $.showWaiting() }
				}).done(function(queryinfor){
					if (false == queryinfor.success) {
						$.toast(queryinfor.error_msg);
						return;
					}
					var i = 0;
					var queryParamArray = {};
					while (queryinfor.data.api_info[i]) {
						var list = queryinfor.data.api_info[i].api_list;
						j = 0;
						while (list[j]) {
							queryParamArray[list[j].api_type] = list[j].api_name;
							j++;
						}
						i++;
					}
					setLocalStorage(STORATE_MANAGER.queryParamArray, queryParamArray);
					
					$.ajax({
						type:"GET",
						data:{ trans_log_no:translogno },
						dataType:"JSON",
						url: CONFIGER_MANAGER.DOMAIN + "ajax_his_report" +  "?u_id=" + getLocalStorage(STORATE_MANAGER.user).u_id,
						async:true
					}).done(function(data){
						if (false == data.success) {
							$.toast(data.error_msg);
							return;
						}						
						queryreport.paintHisQueryResult(data,queryinfor);
					}).always(function(){ $.closeWaiting() });					
				});
				
				


			};
			result.bindEvent = function() {
				queryreport.printReport();
				queryreport.selectResultItem();
			};
			return result;
		}
	};
	
	var thisPage = resultPage.createNew();
	thisPage.init();
});